package cn.magicman.demo;

public class ThreadExample2 {

    public static class MyThread extends Thread {
        public void run() {
            System.out.println("MyThread running");
            System.out.println("MyThread finished");
        }
    }

    public static void main(String[] args) {
        MyThread myThread = new MyThread();
        myThread.start();

        Thread thread = new Thread(() -> {
            System.out.println("当前线程: " + Thread.currentThread().getName());
        });

        thread.start(); // 输出: 当前线程: Thread-0 (在新线程中执行)
    }

}
